import React from "react";
import { Link } from 'react-router-dom';
import About from "../components/About/About";
import HelloWorld from "../components/HelloWorld/HelloWorld";
import { staticRoutes, IFRouteItem } from "../routes/routerConfig";

type P = {}

type S = {}

export default class Home extends React.Component<P, S> {
    render() {
        // 创建页面跳转链接
        const createLink = (list: IFRouteItem[]): React.ReactElement[] => {
            return list.map((item) => {
                return (
                    <li key={item.path}>
                        <Link to={item.path}>{item.title}</Link>
                    </li>
                )
            })
        }
        return (
            <div>
                {createLink(staticRoutes)}
                <About message="react about message" />
                <HelloWorld />
            </div>
        )
    }
}